<?php
require '../../../config.php';
require PATH_ADMIN . 'session.php';
require PATH . 'classes/ofj-orm/Director.php';

define('MENU_ACTIVE', 'orquesta');
$css_arr = array(
  'orquesta/directores.css'
);
require PATH . 'admin/layout/header.php';
?>
<div class="container">
  <div class="well">
    <a href="orquesta/" class="btn">
      <i class="icon-arrow-left"></i>
      Regresar a integrantes
    </a>
    <a href="orquesta/directores/editar.php" class="btn btn-primary">
      <i class="icon-plus-sign icon-white"></i>
      Agregar director
    </a>
  </div>
  <table class="table table-bordered table-striped">
    <thead>
      <tr>
        <th>Director</th>
        <th>Periodo</th>
        <th>Editar</th>
      </tr>
    </thead>
    <tbody>
      <?php
      $directores = Director::instance()->find(array(
        'where' => '`nombre` IS NOT NULL',
        'order_by' => '`anio_inicio` DESC'
      ));
      foreach($directores as $Director):
      ?>
      <tr id="row_director_<?php echo $Director->id ?>">
        <td><?php
          echo htmlentities($Director->nombre. ' '.$Director->apellidos
            , ENT_QUOTES, 'utf-8')
        ?></td>
        <td class="center"><?php echo $Director->getPeriodo() ?></td>
        <td>
          <div class="btn-toolbar">
            <div class="btn-group">
              <a href="orquesta/directores/editar.php?id=<?php
                echo $Director->id
              ?>" class="btn"><i class="icon-edit"></i></a>
              <a href="#" class="btn btn-danger dropdown-toggle"
                data-toggle="dropdown">
                <i class="icon-trash icon-white"></i>
                <span class="caret"></span>
              </a>
              <ul class="dropdown-menu">
                <li class="dropdown-menu-title">¿Confirma borrar?</li>
                <li><a href="#" data-delete="<?php
                  echo $Director->id
                ?>">Sí, borrar.</a></li>
                <li><a href="javascript:;">No.</a></li>
              </ul>
            </div>
          </div>
        </td>
      </tr>
      <?php
      endforeach;
      ?>
    </tbody>
  </table>
</div>
<?php
$js_arr = array(
  'bootstrap-dropdown.js',
  'orquesta/directores/directores.js'
);
require PATH . 'admin/layout/footer.php';
?>